<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>广东省传播平台-刊例录入页</title>
		<link rel="stylesheet" type="text/css" href="<%=path%>/css/common.css" />
		<link rel="stylesheet" type="text/css" href="<%=path%>/css/tag.css" />
		<script type="text/javascript" src="<%=path%>/js/jquery-1.7.2.js"></script>
		<script type="text/javascript">
			function doSubmit(url){
				document.forms[0].action=url;
				document.forms[0].submit();
			}
			function doDel(id){
				var mediaID = $("#mediaID").val();
				if(confirm('确定删除该条记录？')){
					$.ajax({
				        url: "delMediumAction.action?"+new Date()+"&id="+id,
				        type:"POST",
				        cache:false,
				        success: function(data)
				        {
				        	//alert(data.message);
					    	if(data.message == "success")
					    	{
				        		alert("该条记录删除成功！");
				        		//alert(mediaID);
				        		window.location.href="mediumAction.action?mediaID="+mediaID+"&contractYear="+$("#contractYear_01").val()+"&mediaType1="+$("#mediaType1_01").val()+"&priceID="+$("#priceID_01").val();
				        		//doSubmit("mediumAction.action?mediaID="+mediaID);
				        	}
				        	if(data.message == "error"){
					    		alert("删除失败,项目刊例正在使用 ！");
				        	}
				   		}
			     	});
				}
			}
		</script>
	</head>
<body>
<script type="text/javascript">
	$(function(){
        //selectNav('nav2');
    });
</script>
<!-- 顶栏start -->
<jsp:include page="../common/top.jsp"></jsp:include>
<!-- 顶部end -->

<!-- 顶部start -->
<div id="main">

	<div class="body">
	<jsp:include page="../common/nav.jsp"></jsp:include>
		<!-- 主体 -->
		<div class="main_body">
			<form action="mediumAction.action" id="form1" method="post">
					<input type="hidden" name="id" value="${id}"/>
					<input type="hidden" name="medium.id" value="${medium.id}"/>
					<input type="hidden" id="mediaID" name="mediaID" value="${medium.mediaID}"/>
					<input type="hidden" name="medium.priceID" value="${priceID}"/>
					<input type="hidden" id="priceID_01" name="priceID" value="${priceID}"/>
					<input type="hidden" id="contractYear_01" name="contractYear" value="${medium.contractYear}" />
					<input type="hidden" id="mediaType1_01" name="mediaType1" value="${medium.mediaType}" />
			<table style="width:100%; font-size:14px; font-weight:bold; color:#000000;" align="center">
				<tr>
					<td>
						<input type="button" class="btn-title" value="新增" onclick="doSubmit('toAddMediumAction.action');"/>
						<c:if test="${logUser.usercity eq medium.mediaPrice.city}">
							&nbsp;&nbsp;&nbsp;
							<input type="button" class="btn-title" value="编辑" onclick="doSubmit('toUpdateMediumAction.action');"/>
							&nbsp;&nbsp;&nbsp;
							<input type="button" class="btn-title" value="删除" onclick="doDel(${id});" />
							&nbsp;&nbsp;&nbsp;
						</c:if>
						<input type="button" class="btn-title" value="返回" onclick="javascript:history.go(-1);"/>
						<!-- 
						<input type="button" class="btn-title" value="返回" onclick="doSubmit('mediumAction.action');"/>
						 -->
					</td>
				</tr>
			</table>
			
			<div id="list_div">
				<table class="table_list" width="100%">
					<tr class="bg" style="border-left: 2px solid #f37c20;">
						<th colspan="13" style="font-size:15px; padding-left:18px;">刊例信息</th>
					</tr>
					<tr>
						<th style="background:#f2f2f2;width:150px;">刊例名称</th>
						<td style="border-style:solid 1px;width:198px;word-break:break-all;">${medium.mediumName}</td>
						<th style="background:#f2f2f2;width:150px;">媒体名称</th>
						<td style="border-style:solid 1px;width:200px;word-break:break-all;">${medium.mediasumm.mediaName}</td>
						<th style="background:#f2f2f2;width:150px;">年度</th>
						<td style="border-style:solid 1px;width:200px;word-break:break-all;">${medium.contractYear}</td>
					</tr>
					<tr>
						<th style="background:#f2f2f2;">媒体类型</th>
						<td style="border-style:solid 1px;word-break:break-all;">
							<s:iterator id="mtl" value="mediaTypeList">
								<c:if test="${medium.mediaType eq mtl.id}">
									${mtl.datavalue}
								</c:if>
							</s:iterator>
						</td>
						<th style="background:#f2f2f2;">赠送类型</th>
						<td style="border-style:solid 1px;word-break:break-all;">
							<s:iterator id="mtl" value="mediumPromotionTypeList">
								<c:if test="${medium.mediumPromotionType eq mtl.id}">
									${mtl.datavalue}
								</c:if>
							</s:iterator>
						</td>
						<th style="background:#f2f2f2;">刊例能力</th>
						<td style="border-style:solid 1px;word-break:break-all;">
							${medium.mediumAbility}
						</td>
					</tr>
					
					<tr>
						<th style="background:#f2f2f2;">刊例单位</th>
						<td style="border-style:solid 1px;word-break:break-all;">
							<c:if test="${medium.mediumUnit eq ''}">
								无
							</c:if>
							<c:if test="${medium.mediumUnit ne ''}">
								${medium.mediumUnit}
							</c:if>
						</td>
						<th style="background:#f2f2f2;">加收比率</th>
						<td style="border-style:solid 1px;word-break:break-all;">
							<c:if test="${!empty medium.surchargesRatio}">
								<fmt:formatNumber value="${medium.surchargesRatio}" pattern="0"/>
							</c:if>
							<c:if test="${empty medium.surchargesRatio}">
								无
							</c:if>
						</td>
						<th style="background:#f2f2f2;">刊例价(元)</th>
						<td style="border-style:solid 1px;word-break:break-all;">
							<fmt:formatNumber value="${medium.mediumPrice}"/>
						</td>
					</tr>	
					<tr>
						<th style="background:#f2f2f2;">上画时长</th>
						<td style="border-style:solid 1px;word-break:break-all;">
							<c:if test="${empty medium.mediumDuration}">
									无
								</c:if>
								<c:if test="${!empty medium.mediumDuration}">
									${medium.mediumDuration}
								</c:if>
						</td>
						<th style="background:#f2f2f2;">刊例数量</th>
						<td style="border-style:solid 1px;word-break:break-all;">
								<c:if test="${empty medium.mediumNumber}">
								无
							</c:if>
							<c:if test="${!empty medium.mediumNumber}">
								${medium.mediumNumber}
							</c:if>
						</td>
						<td style="border-style:solid 1px;word-break:break-all;" colspan="2">
							&nbsp;
						</td>
					</tr>	
								<s:iterator id="sxl" value="shuXingList" status="i">
									<c:set var="s" value="${fn:trim(sxl.id)}" />
									<c:if test="${(i.index+1)%3==1}">
										<tr>
									</c:if>
									<th style="background: #f2f2f2; width: 200px;word-break:break-all;">
										${sxl.datavalue}
									</th>
									<td
										style="border-style: solid 1px;word-break:break-all;">
										<c:if test="${empty medium[s]}">
													无
												</c:if>
										<c:if test="${!empty medium[s]}">
													${medium[s]}
												</c:if>
									</td>
									<c:if test="${(i.index+1)%3==0}">
										</tr>
									</c:if>
								</s:iterator>
								<tr>
						<th style="background:#f2f2f2;">简要介绍</th>
						<td style="bor:solid 1px;word-break:break-all;text-align: left;" colspan="5">
							&nbsp;&nbsp;${medium.mediumDescription}
						</td>
					</tr>	
				
					<tr class="bg" style="border-left: 2px solid #f37c20;">
						<th colspan="16" style="font-size:15px; padding-left:18px;border-top-style: solid 1px;">变更记录</th>
					</tr>
					<tr style="text-align:left;">
						<td colspan="16">
							<ul>	
							<s:iterator value="logList" id="list">
								<li style="height:30px; line-height:30px;">&nbsp;&nbsp;&nbsp;&nbsp;${list.content}。</li>
							</s:iterator>
							</ul>
						</td>
					</tr>
				  </table>
				</div>
			</form>
			</div>
		</div>
	</div>
	
<!-- 顶部end -->


<!-- 底部start -->
<div id="bottom">
	<div class="body">
		<label>版权所有&nbsp;&nbsp;&nbsp;&nbsp;2012东莞移动</label>
	</div>
</div>
<!-- 底部end -->
</body>
</html>
